package top.kaoshanji.p2ch15a;

/**
 * 代码清单-p2ch15a-441页a：synchronized修饰静态方法
 * author kaoshanji
 * ^_^
 * create time 2025/2/23 18:04
 */
public class StaticCounter {

    // 因为是静态属性，所以，就需要是静态方法
    private static int count = 0;

    public static synchronized void incr() {
        count++;
    }

    public static synchronized int getCount() {
        return count;
    }


}
